/*
 * @Autor: Jackey
 * @Date: 2025-06-30 11:29:45
 * @LastEditTime: 2025-06-30 11:45:28
 * @Description:
 */
package org.springblade.common.config;

import com.p6spy.engine.spy.P6SpyOptions;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;

/**
 * P6Spy自动配置类
 * 仅在开发和测试环境中启用
 *
 * @author Jackey
 * @since 2024-11-15
 */
@Configuration
@Profile({ "prod" })
public class P6SpyConfig {

  @Resource
  private P6SpyLogger p6SpyLogger;

  /**
   * 初始化P6Spy配置
   */
  @PostConstruct
  public void init() {
    // 设置自定义日志格式化器
    P6SpyOptions.getActiveInstance().setLogMessageFormat(P6SpyFormatter.class.getName());
  }
}
